## Carregar o pacote bibliometrix
ifelse(!require(bibliometrix),install.packages("bibliometrix", dependencies=TRUE),1) # instalar pacote se necessario
require(bibliometrix)


## Gerar dataset
# Carregar base de dados da WoS (alterar diretorios)
WoS1 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset/savedrecs(1).bib")
WoS2 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset/savedrecs(2).bib")
WoS3 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset/savedrecs(3).bib")
WoS4 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset/savedrecs(4).bib")

# Converter base da WoS em data-frame
WoS1_df <- convert2df(WoS1, dbsource = "isi", format = "bibtex")
WoS2_df <- convert2df(WoS2, dbsource = "isi", format = "bibtex")
WoS3_df <- convert2df(WoS3, dbsource = "isi", format = "bibtex")
WoS4_df <- convert2df(WoS4, dbsource = "isi", format = "bibtex")

# Carregar base de dados da Scopus (alterar diretorios)
Scopus1 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset//scopus(1).bib")
Scopus2 <- readFiles("C:/Users/Adonai/Paper_Disability/Dataset//scopus(2).bib")

# Converter base da Scopus  em data-frame
Scopus1_df <- convert2df(Scopus1, dbsource = "scopus", format = "bibtex")
Scopus2_df <- convert2df(Scopus2, dbsource = "scopus", format = "bibtex")

# Juntar bases WoS e Scopus
M <- mergeDbSources(WoS1_df, WoS2_df, WoS3_df, WoS4_df, Scopus1_df, Scopus2_df, remove.duplicated = TRUE)

# criar arquivo *.csv a partir do objeto M (bases WoS e Scopus)
write.csv(M, "dataset.csv")
getwd() #identificar diretorio onde foi salvo o arquivo


##Carregar Biblioshiny
biblioshiny()